#Python内置的base64可以直接进行base64的编解码
import base64
x = base64.b64encode(b'lwf777')
print(x)
x = base64.b64decode(b'bHdmNzc3')
print(x)

#"url safe"的base64编码，可以把字符+和/分别变成-和_
x = base64.b64encode(b'i\xb7\x1d\xfb\xef\xff')
print(x)
x = base64.urlsafe_b64encode(b'i\xb7\x1d\xfb\xef\xff')
print(x)
x = base64.urlsafe_b64decode('abcd--__')
print(x)